
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
#include "jlink.h"
#include "lib.h"
#include "hexdump.h"
bool jlinkCommandHWInfo(void* dataBuffer,uint32_t * len)
{
      uint8_t commandBuffer[1] = {EMU_CMD_GET_HW_INFO};
      uint32_t leftLength = *len;
      return jlinkSendCommand(    commandBuffer, sizeof(commandBuffer),dataBuffer,leftLength,len);
}

int main()
{
   uint8_t buffer[1024];
   uint32_t length=sizeof(buffer);
   int r = setup();
   if(r<0) {
      fprintf(stderr,"setup failed.\n");
      goto out;
   }
   if(jlinkCommandHWInfo(buffer,&length))
   {
   	if(length>0) hexdump(buffer,length,16);
   }
   else
   {
       perror("usb");
   }
out:
   cleanup();

}

